<template>
	<view class="page">
		<scroll-view>
			<uni-nav-bar :fixed="true" title="关注" @clickLeft="clickLeft" @clickRight="clickRight">
				<block slot="left">
					<image class="back-img" src="../../static/back.png" mode=""></image>
				</block>
			</uni-nav-bar>
			<view class="search-group">
				<image src="../../static/seach.png" mode="" @click="search()"></image>
				<input type="text" v-model="search_text" placeholder="请输入您要搜索的信息~" placeholder-class="pl-inp" class="search-inp" />
			</view>
			<view class="list" v-if="focusList.length > 0">
				<view class="item" v-for="(column, columnIndex) in focusList" :key="columnIndex">
					<view class="user">
						<image :src="column.headimg!='' ? $util.img(column.headimg) : $util.img('upload/uniapp/default_headimg.png')" mode="aspectFill"></image>
						&nbsp;&nbsp;
						<view class="user-msg">
							<view class="name">
								{{column.nickname}}
							</view>
							<view class="signature" >
								{{$util.timeStampTurnTime(column.time)}}
							</view>
						</view>
					</view>
					<!-- <view class="operation">
						<button type="default" v-if="column.focus_status==1" @click="unlovely(column.live_id)">取消关注</button>
					</view> -->
					<view class="line"></view>
				</view>
			</view>
			<view class="list" v-else>
				<ns-empty :emptyBtn="emptyBtn"></ns-empty>
			</view>
		 </scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 1,
				page: 1,
				page_size: 8,
				search_text: '',
				emptyBtn:{'text':''},
				focusList: []
			}
		},
		onLoad() {
			this.search_text = ''
			this.Getfocus()
		},
		onReachBottom(){
			this.Getfocus()
		},
		methods: {
			unlovely(live_id){
				let that = this;
				let url = '/api/Memberliveplay/roomFocusOut';
				
				this.$api.sendRequest({
					url: url,
					data: {
						live_id: live_id
					},
					success: res => {
						this.page = 1;
						this.Getfocus()
					}
				})
			},
			search(){
				this.page = 1;
				this.Getfocus()
			},
			chose_class(e) {
				this.type = e
				this.focusList = []
				this.search_text = ''
				this.Getfocus()
			},
			clickLeft() {
				this.$util.goBack();
			},
			clickRight() {
				console.log('分享')
				// 分享
			},
			// 关注列表
			Getfocus() {
				let _url = '/api/Memberliveplay/fansLists'
				let _data = {
					page: this.page,
					// page_size: this.page_size,
					search_text: this.search_text
				}
				let that = this;
				this.$api.sendRequest({
					url: _url,
					data: _data,
					success: res => {
						if (res.code == 0) {
							if(that.page == 1){
								that.focusList = res.data.list
							}else {
								for (let i in res.data.list) {
									that.focusList.push(res.data.list[i]);
								}
							}
							that.page++;
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.page {
		/* #ifdef APP-PLUS */
		padding-top: 45rpx;
		/* #endif */
		height: 100vh;
		background-color: #FFFFFF !important;

		.back-img {
			padding-left: 15rpx;
			height: 35rpx;
			width: 20rpx;
		}

		.share-img {
			height: 40rpx;
			width: 40rpx;
		}

		.class-group {
			background-color: white;
			padding: 0 10rpx;
			position: fixed;
			top: 140rpx;
			width: 100%;
			height: 70rpx;
			padding-top: 20rpx;

			.class-item {
				margin: 0rpx 29rpx 0px 29rpx;
				color: #90949A;
				padding-bottom: 8rpx;
				font-size: 30rpx;
				position: relative;
			}

			.ischeck {
				color: #000000;
				font-size: 34rpx;
				padding-bottom: 0rpx;
				border-bottom: 8rpx solid #ffd945;
			}
		}

		.search-group {
			z-index: 10;
			// position: fixed;
			top: 100rpx;
			width: 89%;
			background-color: green;
			display: flex;
			margin: 15rpx 23rpx;
			align-items: center;
			background-color: #F8F8F8;
			border-radius: 90rpx;
			padding: 0 20rpx;

			// justify-content: center;
			image {
				width: 26rpx;
				height: 26rpx;
				padding-right: 7rpx;
			}

			.search-inp {
				padding: 15rpx 0rpx;
				width: 90%;
			}

			.pl-inp {
				font-size: 28rpx;
			}
		}

		.list {
			width: 100%;
			margin-top: 20rpx;
			background-color: #FFFFFF;
			.item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 10rpx 30rpx;
				margin-top: 20rpx;
				position: relative;

				.line {
					position: absolute;
					bottom: -15rpx;
					right: 0;
					height: 2rpx;
					width: 83.5%;
					background-color: #eeeeee;
				}

				.user {
					display: flex;

					image {
						width: 90rpx;
						height: 90rpx;
						border-radius: 50%;
					}

					.user-msg {
						padding-left: 15rpx;
						

						.name {
							font-size: 28rpx;
							max-width:400rpx;
							white-space: nowrap;
							text-overflow: ellipsis;
							overflow: hidden;
							word-break: break-all;
						}

						.signature {
							width: 420rpx;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
							font-size: 24rpx;
							color: #909399;
						}
					}
				}

				.operation {

					button {
						width: 143rpx;
						height: 65rpx;
						padding: 0;
						margin: 0;
						line-height: 65rpx;
						font-size: 26rpx;
						background-color: #CCCCCC;
						color: #FFFFFF;
						border-radius: 45rpx;
						letter-spacing: 2rpx;
					}
				}
			}
		}

		.tell-list {
			width: 100%;
			position: fixed;
			top: 300rpx;

			.ites {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 10rpx 30rpx;
				margin-top: 30rpx;
				position: relative;

				.line {
					position: absolute;
					bottom: -20rpx;
					right: 0;
					height: 2rpx;
					width: 76%;
					background-color: #eeeeee;
				}

				.user-msg {
					display: flex;

					image {
						width: 132rpx;
						height: 132rpx;
						border-radius: 20rpx;
					}

					.user {
						padding-left: 21rpx;
						display: flex;
						flex-direction: column;
						justify-content: space-around;

						.name {
							font-size: 28rpx;
						}

						.detail {
							font-size: 24rpx;
							color: #90949A;

							text:first-child {
								padding-right: 10rpx;
							}
						}
					}
				}

				.tell-go {
					image {
						width: 17rpx;
						height: 31rpx;
					}
				}
			}
		}
	}
</style>
<style scoped>
	/deep/ .uni-navbar--border {
		/* border: none !important; */
		border-bottom: 1rpx solid #F7F7F7;
	}

	/deep/ .uni-navbar__header-btns {
		width: 65rpx;
	}
</style>
